package com.itheima.类加载与反射.反射.反射核心案例_使用场景;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ResourceBundle;

public class 类加载加反射机制案例六 {
    public static void main(String[] args) throws Exception {
        ResourceBundle rb=ResourceBundle.getBundle("prop");
        Class clazz = Class.forName(rb.getString("className"));
        Constructor con = clazz.getDeclaredConstructor();
        con.setAccessible(true);
        Object obj = con.newInstance();
        Method method = clazz.getDeclaredMethod(rb.getString("method"));
        method.setAccessible(true);
        Object invoke = method.invoke(obj);
        if(invoke!=null){
            System.out.println(invoke);
        }

    }
}
